<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>第二题</title>
    <style>
        .box1{
            width: 200px;
			height: 300px;
			background-color: brown;
        }
        .an{
            background-color: black;
            color: white;
        }
    </style>
</head>
<body>
    <div id="app">
        <button @click="dianji">点击</button>
        <div :class="c1" v-if="display" >
            <h3>用户名：</h3>
            <input type="text">
            <h3>密码：</h3>
            <input type="text">
            <button @click="dianji">登录</button>
            <button @click="dianji" :class="an">关闭</button>
        </div>
    </div>
</body>
<script src="./vue.js"></script>
<script>

    const{ createApp,ref}=Vue
    createApp({
        setup(){
            let an = ref('an')  //关闭按钮的class名，点击关闭时class名为an，反之为box1。
            let c1 = ref('box1')
            let display = ref(false)
            function dianji(){               

                display.value=!display.value
            }
            return{
                dianji,
                display,
                c1,
                an
            }
        }   
    }).mount('#app')
    </script>